//
//  ProductSpecDeleteCell.m
//  LazyCat
//
//  Created by Abner on 16/9/22.
//  Copyright © 2016年 zhanshu. All rights reserved.
//

#import "ProductSpecDeleteCell.h"
#import "AddProduct.h"
#import "UIImageView+WebCache.h"

@interface ProductSpecDeleteCell ()
{
    UIView *_topLine; //cell最上面的线，UI要求的，只有indexPath.row == 0时显示；
    UIView *_rightLine;
    UIView *_rightBGView; //右边和背景色一致的view
    NSInteger _currentRow;
    UIView *_bottomLine;
}
@end

@implementation ProductSpecDeleteCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatProductSpecDeleteCellUI];
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self creatProductSpecDeleteCellUI];
}
-(void)setupProductSpecDeleteCell:(LCProductSpec *)aSpec deleteBtTag:(NSInteger)btTag
{
    
    self.deleteBT.tag = btTag+1500;
    if (aSpec) {
         _aSpec = aSpec;//如果模型已有，就不能再创建，是修改模型属性
        if (aSpec.specname.length > 0) {
            self.specNameTf.text = aSpec.specname;
        }else{
            self.specNameTf.text = @"";
        }
        if ([aSpec.marketprice floatValue] >= 0) {
            self.marketPriceTf.text = aSpec.marketprice;
        }else{
            self.marketPriceTf.text = @"";
        }
        
        if ([aSpec.saleprice floatValue] > 0) {
            self.salePriceTf.text = aSpec.saleprice;
        }else{
            self.salePriceTf.text = @"";
        }
        
        if ([aSpec.costprice floatValue] >= 0) {
            self.costPriceTf.text = aSpec.costprice;
        }else{
            self.costPriceTf.text = @"";
        }
        
        if ([aSpec.lcatprice floatValue] >= 0) {
            self.lcSalePriceTf.text = aSpec.lcatprice;
        }else{
            self.lcSalePriceTf.text = @"";
        }
        
        if ([aSpec.commissionprice floatValue] >= 0) {
            self.commissionpriceTf.text = aSpec.commissionprice;
        }else{
            self.commissionpriceTf.text = @"";
        }
        if ([aSpec.numstock floatValue] > 0) {
            self.numStockTf.text = aSpec.numstock;
        }else{
            self.numStockTf.text = @"";
        }
        if (aSpec.localImg || aSpec.mainimage.length > 0) {
            self.specImgV.hidden = NO;
            self.imageTf.hidden = YES;
            self.imageLb.frame = CGRectMake(10, 315, 80, 99);
            self.specImgV.frame = CGRectMake(90, 315+15, 70, 70);
            self.arrowBt.frame = CGRectMake(100, 315, ScreenWidth-150, 99);
            [self.arrowBt setImageEdgeInsets:UIEdgeInsetsMake(43.5, ScreenWidth-150-17, 43.5, 10)]; //7*12
            _rightBGView.frame = CGRectMake(ScreenWidth-50, 0, 50, 415);
            _rightLine.frame = CGRectMake(ScreenWidth-51, 0, 1, 415);
            _bottomLine.frame = CGRectMake(0, 414, ScreenWidth-51, 1);
            self.deleteBT.frame = CGRectMake(0, 182.5, 50, 50);
            [self.deleteBT setImageEdgeInsets:UIEdgeInsetsMake(12.5, 12.5, 12.5, 12.5)];
            
            if (aSpec.localImg) {
                self.specImgV.image = aSpec.localImg;
            }else{
                [self.specImgV sd_setImageWithURL:[NSURL URLWithString:aSpec.mainimage] placeholderImage:[UIImage imageNamed:@"product-no-pic"]];
            }
        }else{
            self.specImgV.hidden = YES;
            self.imageTf.hidden = NO;
            self.imageLb.frame = CGRectMake(10, 315, 80, 44);
            self.imageTf.frame = CGRectMake(90, 315, ScreenWidth-141, 44);
            self.arrowBt.frame = CGRectMake(100, 315, ScreenWidth-150, 44);
            [self.arrowBt setImageEdgeInsets:UIEdgeInsetsMake(16, ScreenWidth-150-17, 16, 10)];
            _rightBGView.frame = CGRectMake(ScreenWidth-50, 0, 50, 360);
            _rightLine.frame = CGRectMake(ScreenWidth-51, 0, 1, 360);
            _bottomLine.frame = CGRectMake(0, 359, ScreenWidth-51, 1);
            self.deleteBT.frame = CGRectMake(0, 155, 50, 50);
            [self.deleteBT setImageEdgeInsets:UIEdgeInsetsMake(12.5, 12.5, 12.5, 12.5)];
        }
    }else{
        _aSpec = [[LCProductSpec alloc]init]; //该方法调一次就初始化一个模型，必须的,不能放在creatProductSpecDeleteCellUI方法中，那样就只有一个。而且，已经有的话就不用再创建
        self.specNameTf.text = @"";
        self.marketPriceTf.text = @"";
        self.salePriceTf.text = @"";
        self.costPriceTf.text = @"";
        self.lcSalePriceTf.text = @"";
        self.commissionpriceTf.text = @"";
        self.numStockTf.text = @"";
        self.specImgV.hidden = YES;
        self.imageTf.hidden = NO;
        self.imageLb.frame = CGRectMake(10, 315, 80, 44);
        self.imageTf.frame = CGRectMake(90, 315, ScreenWidth-141, 44);
        self.arrowBt.frame = CGRectMake(100, 315, ScreenWidth-150, 44);
        [self.arrowBt setImageEdgeInsets:UIEdgeInsetsMake(16, ScreenWidth-150-17, 16, 10)];
        _rightBGView.frame = CGRectMake(ScreenWidth-50, 0, 50, 360);
        _rightLine.frame = CGRectMake(ScreenWidth-51, 0, 1, 360);
        _bottomLine.frame = CGRectMake(0, 359, ScreenWidth-51, 1);
        self.deleteBT.frame = CGRectMake(0, 155, 50, 50);
        [self.deleteBT setImageEdgeInsets:UIEdgeInsetsMake(12.5, 12.5, 12.5, 12.5)];
        
    }
    _currentRow = btTag;
}
-(void)creatLeftLBsUI
{
    self.specNameLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.specNameLb];
    self.specNameLb.font = KAddLeftLbFont;
    self.specNameLb.textColor = KAddLeftLbColor;
    self.specNameLb.frame = CGRectMake(10, 0, 80, 44);
    self.specNameLb.text = @"规格名称";
    UIView *line1 = [[UIView alloc]initWithFrame:CGRectMake(0, 44, ScreenWidth-51, 1)];
    line1.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line1.alpha = 0.5;
    [self.contentView addSubview:line1];
    
    self.salePriceLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.salePriceLb];
    self.salePriceLb.font = KAddLeftLbFont;
    self.salePriceLb.textColor = KAddLeftLbColor;
    self.salePriceLb.frame = CGRectMake(10, 45, 80, 44);
    self.salePriceLb.text = @"市场价";
    UIView *line2 = [[UIView alloc]initWithFrame:CGRectMake(0, 89, ScreenWidth-51, 1)];
    line2.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line2.alpha = 0.5;
    [self.contentView addSubview:line2];
    
    self.salePriceLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.salePriceLb];
    self.salePriceLb.font = KAddLeftLbFont;
    self.salePriceLb.textColor = KAddLeftLbColor;
    self.salePriceLb.frame = CGRectMake(10, 90, 80, 44);
    self.salePriceLb.text = @"销售价";
    UIView *line3 = [[UIView alloc]initWithFrame:CGRectMake(0, 134, ScreenWidth-51, 1)];
    line3.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line3.alpha = 0.5;
    [self.contentView addSubview:line3];
    
    self.lcSalePriceLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.lcSalePriceLb];
    self.lcSalePriceLb.font = KAddLeftLbFont;
    self.lcSalePriceLb.textColor = KAddLeftLbColor;
    self.lcSalePriceLb.frame = CGRectMake(10, 135, 80, 44);
    self.lcSalePriceLb.text = @"成本价";
    UIView *line4 = [[UIView alloc]initWithFrame:CGRectMake(0, 179, ScreenWidth-51, 1)];
    line4.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line4.alpha = 0.5;
    [self.contentView addSubview:line4];
    
    self.lcSalePriceLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.lcSalePriceLb];
    self.lcSalePriceLb.font = KAddLeftLbFont;
    self.lcSalePriceLb.textColor = KAddLeftLbColor;
    self.lcSalePriceLb.frame = CGRectMake(10, 180, 80, 44);
    self.lcSalePriceLb.text = @"懒猫价";
    UIView *line5 = [[UIView alloc]initWithFrame:CGRectMake(0, 224, ScreenWidth-51, 1)];
    line5.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line5.alpha = 0.5;
    [self.contentView addSubview:line5];
    
    self.lcSalePriceLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.lcSalePriceLb];
    self.lcSalePriceLb.font = KAddLeftLbFont;
    self.lcSalePriceLb.textColor = KAddLeftLbColor;
    self.lcSalePriceLb.frame = CGRectMake(10, 225, 80, 44);
    self.lcSalePriceLb.text = @"分销佣金";
    UIView *line6 = [[UIView alloc]initWithFrame:CGRectMake(0, 269, ScreenWidth-51, 1)];
    line6.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line6.alpha = 0.5;
    [self.contentView addSubview:line6];
    
    self.numStockLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.numStockLb];
    self.numStockLb.font = KAddLeftLbFont;
    self.numStockLb.textColor = KAddLeftLbColor;
    self.numStockLb.frame = CGRectMake(10, 270, 80, 44);
    self.numStockLb.text = @"库存";
    UIView *line7 = [[UIView alloc]initWithFrame:CGRectMake(0, 314, ScreenWidth-51, 1)];
    line7.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    line7.alpha = 0.5;
    [self.contentView addSubview:line7];
    
    self.imageLb = [[UILabel alloc]init];
    [self.contentView addSubview:self.imageLb];
    self.imageLb.font = KAddLeftLbFont;
    self.imageLb.textColor = KAddLeftLbColor;
    self.imageLb.frame = CGRectMake(10, 315, 80, 44);
    self.imageLb.text = @"对应图片";
    
    _bottomLine = [[UIView alloc]init];
    _bottomLine.frame = CGRectMake(0, 359, ScreenWidth-51, 1);
    _bottomLine.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    _bottomLine.alpha = 0.5;
    [self.contentView addSubview:_bottomLine];
}
-(void)creatRightTFsUI
{
    self.specNameTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.specNameTf];
    self.specNameTf.textColor = KAddLeftLbColor;
    self.specNameTf.font = KAddLeftLbFont;
    self.specNameTf.frame = CGRectMake(90, 0, ScreenWidth-141, 44);
    [self.specNameTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.specNameTf.placeholder = @"请输入规格名称";
    [self.specNameTf limitTextLength:30];
    
    self.marketPriceTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.marketPriceTf];
    self.marketPriceTf.textColor = KAddLeftLbColor;
    self.marketPriceTf.font = KAddLeftLbFont;
    self.marketPriceTf.frame = CGRectMake(90, 45, ScreenWidth-141, 44);
    [self.marketPriceTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.marketPriceTf.placeholder = @"0.00";
    
    self.salePriceTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.salePriceTf];
    self.salePriceTf.textColor = KAddLeftLbColor;
    self.salePriceTf.font = KAddLeftLbFont;
    self.salePriceTf.frame = CGRectMake(90, 90, ScreenWidth-141, 44);
    [self.salePriceTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.salePriceTf.placeholder = @"给商品定个好价格";
    
    //成本价
    self.costPriceTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.costPriceTf];
    self.costPriceTf.textColor = KAddLeftLbColor;
    self.costPriceTf.font = KAddLeftLbFont;
    self.costPriceTf.frame = CGRectMake(90, 135, ScreenWidth-141, 44);
    [self.costPriceTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.costPriceTf.placeholder = @"请输入成本价";
    
    self.lcSalePriceTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.lcSalePriceTf];
    self.lcSalePriceTf.textColor = KAddLeftLbColor;
    self.lcSalePriceTf.font = KAddLeftLbFont;
    self.lcSalePriceTf.frame = CGRectMake(90, 180, ScreenWidth-141, 44);
    [self.lcSalePriceTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.lcSalePriceTf.placeholder = @"0.00";
    
    self.commissionpriceTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.commissionpriceTf];
    self.commissionpriceTf.textColor = KAddLeftLbColor;
    self.commissionpriceTf.font = KAddLeftLbFont;
    self.commissionpriceTf.frame = CGRectMake(90, 225, ScreenWidth-141, 44);
    [self.commissionpriceTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.commissionpriceTf.placeholder = @"0.00";
    
    self.numStockTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.numStockTf];
    self.numStockTf.textColor = KAddLeftLbColor;
    self.numStockTf.font = KAddLeftLbFont;
    self.numStockTf.frame = CGRectMake(90, 270, ScreenWidth-141, 44);
    [self.numStockTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.numStockTf.placeholder = @"设置合理库存避免超卖";
    
    self.imageTf = [[UITextField alloc]init];
    [self.contentView addSubview:self.imageTf];
    self.imageTf.textColor = KAddLeftLbColor;
    self.imageTf.font = KAddLeftLbFont;
    self.imageTf.frame = CGRectMake(90, 315, ScreenWidth-141, 44);
    [self.imageTf addTarget:self action:@selector(detailTfDidChanged:) forControlEvents:UIControlEventEditingChanged];
    self.imageTf.placeholder = @"请选择商品对应图片";
    self.imageTf.userInteractionEnabled = NO; //选择图片的不允许交互
    
     //设置标签
    self.specNameTf.tag = 1571;
    self.marketPriceTf.tag = 1572;
    self.salePriceTf.tag = 1573;
    self.costPriceTf.tag = 1574;
    self.lcSalePriceTf.tag = 1575;
    self.commissionpriceTf.tag = 1576;
    self.numStockTf.tag = 1577;
    self.imageTf.tag = 1578;
    
    //键盘弹出类型
    self.marketPriceTf.keyboardType = UIKeyboardTypeDecimalPad;
    self.salePriceTf.keyboardType = UIKeyboardTypeDecimalPad;
    self.costPriceTf.keyboardType = UIKeyboardTypeDecimalPad;
    self.lcSalePriceTf.keyboardType = UIKeyboardTypeDecimalPad;
    self.commissionpriceTf.keyboardType = UIKeyboardTypeDecimalPad;
    self.numStockTf.keyboardType = UIKeyboardTypeNumberPad;
    
    //设置代理
    self.specNameTf.delegate = self;
    self.marketPriceTf.delegate = self;
    self.salePriceTf.delegate = self;
    self.costPriceTf.delegate = self;
    self.lcSalePriceTf.delegate = self;
    self.commissionpriceTf.delegate = self;
    self.numStockTf.delegate = self;
    self.imageTf.delegate = self;
    
    self.specNameTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.marketPriceTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.salePriceTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.costPriceTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.lcSalePriceTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.commissionpriceTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.numStockTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.imageTf.clearButtonMode = UITextFieldViewModeWhileEditing;
}
-(void)detailTfDidChanged:(UITextField *)tf
{
    if (tf.tag >= 1572 && tf.tag <= 1576) {
        [Utils LC_LimitedPointOnlyOne:tf];
    }
    LCLog(@"tf.text is ---%@",tf.text);
    switch (tf.tag) {
        case 1571:
        {
            _aSpec.specname = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1572:
        {
            _aSpec.marketprice = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1573:
        {
            _aSpec.saleprice = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1574:
        {
            _aSpec.costprice = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1575:
        {
            _aSpec.lcatprice = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1576:
        {
            _aSpec.commissionprice = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1577:
        {
            _aSpec.numstock = tf.text;
            [self setupBlock:tf.text];
        }
            break;
        case 1578:
        {
            
        }
            break;
            
        default:
            break;
    }
}
-(void)setupBlock:(NSString *)tfText
{
    if (tfText.length > 0) {
        if (self.specDeleteBlock) {
            self.specDeleteBlock(_aSpec,_currentRow);
        }
    }
    
}
#pragma mark ---UITextField代理
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (textField.tag == 1577) {//1577库存
        //  判断输入的是否为数字 (只能输入数字)
        NSString *validRegEx =@"^[0-9]*$";
        NSPredicate *regExPredicate =[NSPredicate predicateWithFormat:@"SELF MATCHES %@", validRegEx];
        BOOL myStringMatchesRegEx = [regExPredicate evaluateWithObject:string];
        if (myStringMatchesRegEx){
            return YES;
        }else{
            return NO;
        }
    }else if (textField.tag >= 1572 && textField.tag <= 1576){ //各种价格
        NSCharacterSet *cs;
        cs = [[NSCharacterSet characterSetWithCharactersInString:kNumbersPeriod] invertedSet];
        NSString *filtered =
        [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
        BOOL basic = [string isEqualToString:filtered];
        if (basic) {
            NSMutableString * futureString = [NSMutableString stringWithString:textField.text];
            [futureString  insertString:string atIndex:range.location];
            
            NSInteger flag=0;
            
            const NSInteger limited = 2;//小数点后需要限制的个数
            
            for (int i = (int)futureString.length-1; i>=0; i--) {
                if ([futureString characterAtIndex:i] == '.') {
                    
                    if (flag > limited) {
                        return NO;
                    }
                    break;
                }
                flag++;
            }
            
            return YES;
        }else{
            return NO;
        }
        
    }else{
        return YES;
    }
    
}
-(void)creatProductSpecDeleteCellUI
{
    _topLine = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth-51, 1)];
    _topLine.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    _topLine.alpha = 0.5;
    [self.contentView addSubview:_topLine];
    
    [self creatLeftLBsUI];
    [self creatRightTFsUI];
    
    self.arrowBt = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.arrowBt];
    [self.arrowBt setImage:[UIImage imageNamed:@"arrow_icon"] forState:UIControlStateNormal];//7*12
    [self.arrowBt setImage:[UIImage imageNamed:@"arrow_icon"] forState:UIControlStateHighlighted];
    [self.arrowBt setImageEdgeInsets:UIEdgeInsetsMake(16, ScreenWidth-150-17, 16, 10)];
    [self.arrowBt addTarget:self action:@selector(arrowBtClicked) forControlEvents:UIControlEventTouchUpInside];
    self.arrowBt.frame = CGRectMake(100, 315, ScreenWidth-150, 44);
    
    self.specImgV = [[UIImageView alloc]init];
    [self.contentView addSubview:self.specImgV];
    self.specImgV.contentMode = UIViewContentModeScaleToFill;
    self.specImgV.frame = CGRectMake(90, 15, 70, 70);
    
    _rightLine = [[UIView alloc]init];
    _rightLine.frame = CGRectMake(ScreenWidth-51, 0, 1, 360);
    _rightLine.backgroundColor = SetColorRGBValue(0xe0e0e0, 1.0);
    _rightLine.alpha = 0.5;
    [self.contentView addSubview:_rightLine];
    
    _rightBGView = [[UIView alloc]init];
    _rightBGView.frame = CGRectMake(ScreenWidth-50, 0, 50, 360);
    [self.contentView addSubview:_rightBGView];
    _rightBGView.backgroundColor = SetColorRGBValue(0xF9F9F9, 1.0);
    
    self.deleteBT = [UIButton buttonWithType:UIButtonTypeCustom];
    [_rightBGView addSubview:self.deleteBT];
    self.deleteBT.frame = CGRectMake(0, 155, 50, 50);
    [self.deleteBT setImage:[UIImage imageNamed:@"delect_icon"] forState:UIControlStateNormal];
    [self.deleteBT setImage:[UIImage imageNamed:@"delect_icon"] forState:UIControlStateHighlighted];
    [self.deleteBT setImageEdgeInsets:UIEdgeInsetsMake(12.5, 12.5, 12.5, 12.5)];
    [self.deleteBT addTarget:self action:@selector(deleteBtClicked) forControlEvents:UIControlEventTouchUpInside];
}

#pragma mark --- 跳转到图片界面，去选择图片
-(void)arrowBtClicked
{
    LCLog(@"(delete)跳转到图片界面，去选择图片");
    if (self.ProductSpecDeleteCellArrowBlock) {
        self.ProductSpecDeleteCellArrowBlock();
    }
}
-(void)deleteBtClicked
{
    if ([self.delegate respondsToSelector:@selector(specDeleteBtClicked:)]) {
        [self.delegate specDeleteBtClicked:self.deleteBT];
    }
}
-(void)setFrame:(CGRect)frame
{
    frame = CGRectMake(frame.origin.x, frame.origin.y+10, frame.size.width, frame.size.height-10);
    [super setFrame:frame];
}
+(instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *indetifier = @"ProductSpecDeleteCellIdentifier";
    ProductSpecDeleteCell *cell = [tableView dequeueReusableCellWithIdentifier:indetifier];
    if (!cell) {
        cell = [[ProductSpecDeleteCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indetifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
